import os
from config import base_url, STAG
from datetime import datetime


def record(content):
    report_dir = f"{base_url}/report"
    if not os.path.exists(report_dir):
        os.mkdir(report_dir)

    file_name = f"report.txt"

    with open(f"{report_dir}/{file_name}", "a+", encoding="utf-8") as f:
        f.write(f"\n*************执行结果(环境：{STAG})：*************\n"
                f"\t执行时间：{datetime.now()}\n"
                f"\t结果内容：{content}\n")
        f.flush()
